package com.itheima.lambda2;

import java.util.Random;

public class TestLambda {
    public static void main(String[] args) {
        useInterface(() -> {
            Random random = new Random();
            int i = random.nextInt(10) + 1;
            return i;
        });


        useInterface(() -> {
            return new Random().nextInt(10) + 1;
        });
    }

    //定义一个方法参数传递接口类型：
    public static void useInterface(UseRandom useRandom) {
        int random = useRandom.getRandom();
        System.out.println(random);
    }

}
